package com.ninogame.state;

import java.io.IOException;
import java.util.ArrayList;

import org.xmlpull.v1.XmlPullParserException;

import com.ninogame.BitmapFont;
import com.ninogame.Dialog;
import com.ninogame.GameLayer;
import com.ninogame.GameLib;
import com.ninogame.IConstant;
import com.ninogame.MazeEscape;
import com.ninogame.Map;
import com.ninogame.Actor.Creature;
import com.ninogame.Actor.Explorer;
import com.ninogame.resolution.DEF;


import android.R.color;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Paint.Style;
import android.view.KeyEvent;


public class StateWin extends MazeEscape implements IConstant 
{
	public static RectF rectF;
	public static int MENU_BACKGROUND_W = SCREEN_WIDTH / 4 * 3;
	public static int MENU_BACKGROUND_H = SCREEN_HEIGHT / 6 * 5;
	public static int MENU_H = SCREEN_HEIGHT;
	public static synchronized void SendMessage(int type) {

		switch (type) {
		case MESSAGE_CTOR:
			rectF = new RectF((SCREEN_WIDTH - MENU_BACKGROUND_W)/2, (SCREEN_HEIGHT - MENU_BACKGROUND_H)/2, (SCREEN_WIDTH - MENU_BACKGROUND_W)/2 +MENU_BACKGROUND_W , (SCREEN_HEIGHT - MENU_BACKGROUND_H)/2 + MENU_BACKGROUND_H);
			
			break;
		case MESSAGE_UPDATE:
		
			if(GameLib.isTouchReleaseScreen())
			{
				changeState(STATE_GAMEPLAY);
			}
			
			break;
		case MESSAGE_PAINT:
			StateGameplay.SendMessage(MESSAGE_PAINT);
			if (Dialog.isShowDialog) {
				Dialog.drawDialog(mainCanvas);
				return;
			}
			MazeEscape.mainPaint.setStyle(Style.FILL);
			MazeEscape.mainPaint.setARGB(150, 0, 0, 0);
			MazeEscape.mainCanvas.drawRect(0, 0, MazeEscape.SCREEN_WIDTH, MazeEscape.SCREEN_HEIGHT, MazeEscape.mainPaint);
			
			MazeEscape.mainPaint.setStyle(Style.FILL);
			MazeEscape.mainPaint.setARGB(200, 0, 0, 0);
			MazeEscape.mainCanvas.drawRect(0, 0, MazeEscape.SCREEN_WIDTH, MazeEscape.SCREEN_HEIGHT, MazeEscape.mainPaint);
			MazeEscape.mainPaint.setStyle(Style.FILL_AND_STROKE);
			MazeEscape.mainPaint.setColor(Color.rgb(67, 120, 167));
			MazeEscape.mainCanvas.drawRoundRect(rectF, 25, 25, MazeEscape.mainPaint);//HOWTOPLAY_TITLE_CONTENT_SPACE_H

			//draw text

			MazeEscape.fontbig_Yellow.drawString(MazeEscape.mainCanvas, "YOU WIN", DEF.HOWTOPLAY_TITLE_X, DEF.HOWTOPLAY_TITLE_Y, BitmapFont.ALIGN_CENTER);

			break;
		case MESSAGE_DTOR:
			break;
		}
	}
}
